import request from '@/utils/request'

export default{
    //1、讲师列表（条件分页查询）
    // getTeacherListPage方法名,参数不需要带参数类型，current是当前页，limit是当前页的条数
    //teacherQuery是封装的条件的对象
     getTeacherListPage(current, limit,teacherQuery) {
        return request({
            //url: '/eduservice/teacher/pageTeacherCondition/'+current+'/'+limit,
            url: `/eduservice/teacher/pageTeacherCondition/${current}/${limit}`,
            method: 'post', 
            //teacherQuery条件对象，将后端使用的RequestBody获取到数据
            //使用data将对象转换为json格式的数据传递到接口里面
            data:teacherQuery
        })
    },
    //2、删除讲师
    deleteTeacherById(id){
        return request({
            url: `/eduservice/teacher/${id}`,
            method: 'delete',
        });
    },
    
    //3、添加讲师
    saveTeacher(teacher){
        return request({
            url:`/eduservice/teacher/addTeacher`,
            method:'post',
            data:teacher
        });
    },

    //4、根据id查询讲师，也就是讲师的回显
    getTeacherInfo(id){
        return request({
            url:`/eduservice/teacher/getTeacher/${id}`,
            method:'get'
        });
    },
    //5、修改讲师
    updateTeacherInfo(teacher){
        return request({
            url:`/eduservice/teacher/updateTeacher`,
            method:'post',
            data:teacher
        });
    }
}    